public class BracketMatchTest {
    public static void main(String[] args) {
        BracketMatch bracketMatch = new BracketMatch();


        // 多种括号匹配
        String test1 = "()[]{}";
        System.out.println( test1 + " - " + bracketMatch.isValid(test1) );// ()[]{} - true

        // 嵌套括号
        String test2 = "([{}])";
        System.out.println(test2 + " - " + bracketMatch.isValid(test2) );// ([{}]) - true

        // 不匹配的括号
        String test3 = "(]";
        System.out.println(test3 + " - " + bracketMatch.isValid(test3) );// (] - false

        // 只有左括号
        String test4 = "([{";
        System.out.println(test4 + " - " + bracketMatch.isValid(test4) );// ([{ - false

        // 只有右括号
        String test5 = ")]}";
        System.out.println( test5 + " - " + bracketMatch.isValid(test5) );// )]} - false

        // 空字符串
        String test6 = "";
        System.out.println(test6 + " - " + bracketMatch.isValid(test6) );//  - true

        // 复杂嵌套
        String test7 = "({[()]}[{}])";
        System.out.println(test7 + " - " + bracketMatch.isValid(test7) );// ({[()]}[{}]) - true

        // 顺序不匹配
        String test8 = "([)]";
        System.out.println(test8 + " - " + bracketMatch.isValid(test8) );// ([)] - false
    }
}